home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / filecat.arc / FMAIN03.INC < prev    next >
Text File  |  1986-05-14  |  28KB  |  813 lines

  1. OVERLAY PROCEDURE DoEntry;
  2.   VAR I,N,RecNum:Integer;
  3.       SkipDup:Boolean;
  4.   PROCEDURE AddRecord;
  5.     Begin
  6.       With FileRec do begin
  7.         Status:=0;
  8.         FileName:=Entry[N].EName+'.'+Entry[N].EExt;
  9.         FileTime:=Entry[N].ETime;
  10.         FileDate:=Entry[N].EDate;
  11.         For I := 1 to 4 do FileSize[I]:=Entry[N].ESize[I];
  12.         Floppy:=False;
  13.         If SourceDirectory[1] in ['A','B'] then Floppy:=True;
  14.         VolPath:=SourceDirectory;
  15.         If Floppy then VolPath:=OldVolumeName;
  16.       End;
  17.       FKey:=Entry[N].EName+Entry[N].EExt;
  18.       FKey:=FKey+ConstStr(' ',13-Length(FKey));
  19.       If FileRec.StandAlone then FKey:=FKey+'1' Else FKey:=FKey+'0';
  20.       AddRec(CFile,RecNum,FileRec);
  21.       If OK then begin
  22.         AddKey(CIndex,RecNum,FKey);
  23.         AddKeywords;
  24.       End;
  25.       If NOT OK then begin
  26.         DeleteRec(CFile,RecNum);
  27.         GotoXY(1,24);ClrEol;
  28.         Beep;
  29.         Write('Error writing Record');
  30.       End;
  31.     End; { procedure AddRecord }
  32.  
  33.   Begin
  34.     ShowScreen;
  35.     FillChar(FileRec,SizeOf(FileRec),0);
  36.     GotoXY(1,23);
  37.     Write('Use Cursor UP, DOWN, HOME, END, PGUP, and PGDN, then');
  38.     GotoXY(1,24);
  39.     Write('press Return to select file from list.  Press ESC to quit. -->');
  40.     GotoXY(1,25);
  41.     Write('Press <F1> to enter ALL files   <S> to SORT into alpha order');
  42.     SaveScreen;
  43.     DrawBox(65,79,1,25);
  44.     BigWindow(66,2,78,24);
  45.     If MonitorType = 7 then begin
  46.       HideCursor;
  47.       For I:=1 to 23 do begin
  48.         GotoXY(1,I);
  49.         Write(ConstStr(' ',13));
  50.       End;
  51.       RestoreCursor;
  52.       GotoXY(1,1);
  53.     End Else ClrScr;
  54.     LowVideo;
  55.     UpdateArray;
  56.     NormVideo;
  57.     N:=SelectFile;
  58.     BigWindow(1,1,80,25);
  59.     RestoreScreen;
  60.     GotoXY(1,23);ClrEol;
  61.     GotoXY(1,24);ClrEol;
  62.     NormVideo;
  63.     If N=0 then Exit;
  64.     If N=-1 then begin
  65.       For I:=23 to 25 do begin
  66.         GotoXY(1,I);
  67.         ClrEol;
  68.       End;
  69.       GotoXY(1,24);
  70.       Write('Enter ALL ',EntryNum,' files into database... Continue?  Y/N');
  71.       Beep;
  72.       If YES then begin
  73.         GotoXY(1,24);ClrEol;
  74.         Write('Ignore duplicate file names?  Y/N');
  75.         Beep;
  76.         SkipDup:=False;
  77.         If YES then SkipDup:=True;
  78.         OpenFiles;
  79.         For N:=1 to EntryNum do begin
  80.           ShowEntry(N);
  81.           If (Entry[N].EStatus=1) and SkipDup then begin
  82.             GotoXY(1,24);ClrEol;
  83.             Write('Ignoring duplicate filename:  ',Entry[N].EName,'.',Entry[N].EExt);
  84.             Boop;
  85.           End Else begin
  86.             FillChar(FTemp,SizeOf(FTemp),0);
  87.             If Length(FTemp.ParentName)<12 then FTemp.ParentName:='        .   ';
  88.             FTemp.StandAlone:=True;
  89.             FileRec:=FTemp;
  90.             AddRecord;
  91.           End;
  92.         End;
  93.         CloseFiles;
  94.       End;
  95.       Exit;
  96.     End;
  97.     If Entry[N].EStatus=1 then begin
  98.       ShowDuplicate(N);
  99.       If Ch='Q' then Exit;
  100.       ShowScreen;
  101.     End;
  102.     ShowEntry(N);
  103.     FillChar(FTemp,SizeOf(FTemp),0);
  104.     OpenFiles;
  105.     EnterData;
  106.     FileRec:=FTemp;
  107.     Write('ADD the above entry to the database? Y/N ');
  108.     If YES then AddRecord;
  109.     CloseFiles;
  110.     GotoXY(1,24);ClrEol;
  111.     Beep;
  112.     Write('Another entry from this disk/directory? Y/N ');
  113.     If YES then DoEntry;
  114.   End; { procedure DoEntry }
  115.  
  116. OVERLAY PROCEDURE BrowseEdit;
  117.   VAR S,S1,S2,SKey,FKey:AnyStr;
  118.       RecNum:Integer;
  119.       Done,Printed,FullMatch,Matched,KeyCat:Boolean;
  120.       I,J,K,MatchCount:Integer;
  121.  
  122.   PROCEDURE EnterSearch;
  123.     Begin
  124.       SaveScreen;
  125.       DrawBox(10,70,17,21);
  126.       BigWindow(11,18,69,20);
  127.       If MonitorType = 7 then begin
  128.         HideCursor;
  129.         For I:=1 to 3 do begin
  130.           GotoXY(1,I);
  131.           Write(ConstStr(' ',59));
  132.         End;
  133.         RestoreCursor;
  134.       End Else ClrScr;
  135.       LowVideo;
  136.       If KeySearch then begin
  137.         GotoXY(5,2);
  138.         Write(' Keyword to Search For:');
  139.         S1:='';
  140.         InputStr(S1,24,30,2,Af,[#13],Ch);
  141.         For I:= 1 to Length(S1) do S1[I]:=Upcase(S1[I]);
  142.         HideCursor;
  143.         If Pos(' ',S1)>0 then begin
  144.           Boop;
  145.           GotoXY(2,1); Write('"',S1,'" truncated to "');
  146.           S1[0]:=Chr(Pos(' ',S1)-1);
  147.           Write(S1,'"');
  148.         End;
  149.         GotoXY(2,2); ClrEol;
  150.         Write('Display:   <E> Exact matches   <P> Partial matches');
  151.         Repeat
  152.           Read(Kbd,Ch);
  153.           Ch:=Upcase(Ch);
  154.           If NOT (Ch in ['E','P']) then Boop;
  155.         Until Ch in ['E','P'];
  156.         If Ch='E' then FullMatch:=True else FullMatch:=False;
  157.         GotoXY(2,2); ClrEol;
  158.         KeyCat:=False;
  159.         Write('    Print a catalog listing on printer?  Y/N');
  160.         If YES then KeyCat:=True;
  161.       End Else begin
  162.         GotoXY(5,2);
  163.         Write('File Name to Search For:');
  164.         S1:='';
  165.         RestoreCursor;
  166.         InputStr(S1,12,30,2,Af,[#13],Ch);
  167.         For I:= 1 to Length(S1) do S1[I]:=Upcase(S1[I]);
  168.         I:=Pos('.',S1);
  169.         If I>0 then
  170.           While Pos('.',S1)<>9 do S1:=Copy(S1,1,I-1)+' '+Copy(S1,I,length(S1));
  171.         I:=Pos('.',S1);
  172.         If I=9 then Delete(S1,I,1);
  173.       End;
  174.       NormVideo;
  175.       BigWindow(1,1,80,25);
  176.       RestoreScreen;
  177.       FKey:=S1;
  178.       SKey:=S1;
  179.       HideCursor;
  180.     End; { procedure EnterSearch }
  181.  
  182.     PROCEDURE FileSearch;
  183.       Begin
  184.         SearchKey(CIndex,RecNum,FKey);
  185.         S1:=Copy(FKey,1,11);
  186.         Done:=False;
  187.         If NOT OK then begin
  188.           Boop;
  189.           GotoXY(1,1); Write(S2,' not found');
  190.           If NOT OK then begin
  191.             FKey:='';
  192.             ClearKey(CIndex);
  193.             SearchKey(CIndex,RecNum,FKey);
  194.           End;
  195.         End;
  196.         If Ok then begin
  197.         Repeat
  198.           If NOT Printed then ShowData(RecNum);
  199.           Printed:=False;
  200.           GotoXY(1,23);
  201.           If (FileRec.FileName=FileRec.ParentName) and
  202.              (NOT FileRec.StandAlone) and (NOT ChildFlag) then begin
  203.              LowVideo;
  204.              Write('MAIN FILE DISPLAYED...  ENTER <A> TO FIND ASSOCIATED FILES');
  205.              Beep;
  206.              NormVideo;
  207.           End Else If ChildFlag then begin
  208.             If ChildCount=0 then ChildFlag:=False;
  209.             LowVideo;
  210.             Write('Showing ',ChildMatch,' Associated File ');
  211.             NormVideo;
  212.             Write(ChildSelect,' of ',ChildCount,' <--');
  213.           End Else Write('Browsing Records Currently Entered in FILECAT Database...');
  214.           ClrEol;
  215.           GotoXY(1,25);
  216.           If ChildFlag then Write('        <*> Print Record  <S> Search for Different File Name')
  217.             Else Write('        <E> Edit  <*> Print Record  <S> Search');
  218.           ClrEol;
  219.           GotoXY(1,24);
  220.           If ChildFlag then Write('Press:  <N> Next  <P> Previous  <Q> Quit ')
  221.             Else Write('Press:  <N> Next  <P> Previous  <Q> Quit  <D> Delete  ');
  222.           ClrEol;
  223.           Repeat
  224.             Read(Kbd,Ch);
  225.             Ch:=Upcase(Ch);
  226.             If NOT (Ch in ['N','P','Q','D','E','*','S','A']) then Boop;
  227.             Until Ch in ['N','P','Q','D','E','*','S','A'];
  228.             Case Ch of
  229.               'Q' : Done:=True;
  230.               'N' : Begin
  231.                       If ChildFlag then begin
  232.                         ChildSelect:=ChildSelect+1;
  233.                         If ChildSelect>ChildCount then ChildSelect:=1;
  234.                         RecNum:=ChildArray[ChildSelect].CNum;
  235.                       End Else Begin
  236.                         NextKey(CIndex,RecNum,FKey);
  237.                         GotoXY(1,1); Write(ConstStr(' ',40)); GotoXY(1,1);
  238.                         If NOT OK then Write('First Record');
  239.                         If NOT OK then NextKey(CIndex,RecNum,FKey);
  240.                       End;
  241.                     End;
  242.               'P' : Begin
  243.                       If ChildFlag then begin
  244.                         ChildSelect:=ChildSelect-1;
  245.                         If ChildSelect<1 then ChildSelect:=ChildCount;
  246.                         RecNum:=ChildArray[ChildSelect].CNum;
  247.                       End Else Begin
  248.                         PrevKey(CIndex,RecNum,FKey);
  249.                         GotoXY(1,1); Write(ConstStr(' ',40)); GotoXY(1,1);
  250.                         If NOT OK then Write('Last Record ');
  251.                         If NOT OK then PrevKey(CIndex,RecNum,FKey);
  252.                       End;
  253.                     End;
  254.               'D' : If NOT ChildFlag then Begin
  255.                       Beep;
  256.                       TextColor(7+Blink);
  257.                       Write('Are you sure? Y/N ');
  258.                       NormVideo;
  259.                       RestoreCursor;
  260.                       If YES then begin
  261.                         DeleteRec(CFile,RecNum);
  262.                         DeleteKey(CIndex,RecNum,FKey);
  263.                         SearchKey(CIndex,RecNum,FKey);
  264.                       End;
  265.                       HideCursor;
  266.                     End;
  267.               'E' : If NOT ChildFlag then Begin
  268.                       FTemp:=FileRec;
  269.                       Textcolor(7+blink);
  270.                       GotoXY(1,1); ClrEol;
  271.                       Write('EDITING');
  272.                       Normvideo;
  273.                       RestoreCursor;
  274.                       EnterData;
  275.                       FileRec:=FTemp;
  276.                       AddKeywords;
  277.                       PutRec(CFile,RecNum,FileRec);
  278.                       HideCursor;
  279.                       GotoXY(1,1); ClrEol;
  280.                       GotoXY(60,1);Write('Browse / Edit');
  281.                     End;
  282.               '*' : Begin
  283.                       GotoXY(1,1); Write(ConstStr(' ',40));
  284.                       PrintRec;
  285.                       Printed:=True;
  286.                     End;
  287.               'S' : Begin
  288.                       ChildFlag:=False;
  289.                       GotoXY(1,1); Write(ConstStr(' ',40));
  290.                       S2:=FKey;
  291.                       EnterSearch;
  292.                       S1:=FKey;
  293.                       ClearKey(CIndex);
  294.                       SearchKey(CIndex,RecNum,FKey);
  295.                       If (Copy(FKey,1,Length(S1))<>S1) or (NOT OK) then begin
  296.                         Boop;
  297.                         GotoXY(1,1); Write(S1,' not found');
  298.                         If NOT OK then begin
  299.                           FKey:=S2;
  300.                           ClearKey(CIndex);
  301.                           SearchKey(CIndex,RecNum,FKey);
  302.                         End;
  303.                       End;
  304.                       NormVideo;
  305.                     End;
  306.               'A' : If (FileRec.FileName=FileRec.ParentName)
  307.                     and (NOT FileRec.StandAlone)
  308.                     and (NOT ChildFlag) then begin
  309.                       CloseFiles;
  310.                       ReportChoice:='c';
  311.                       ChildCount:=0;
  312.                       ChildSelect:=0;
  313.                       ChildMatch:=FileRec.ParentName;
  314.                       GotoXY(1,1); Write('Please wait... searching');
  315.                       I:=TurboSort(SizeOf(SortKey));
  316.                       OpenFiles;
  317.                       ChildFlag:=True;
  318.                       GotoXY(1,1);ClrEol;
  319.                       If (I=0) and (ChildCount>0) then begin
  320.                         ChildFlag:=True;
  321.                         ChildSelect:=1;
  322.                         RecNum:=ChildArray[ChildSelect].CNum;
  323.                       End Else begin
  324.                         Boop;
  325.                         Textcolor(7+blink);
  326.                         If I<>0 then Write('TURBOSORT ERROR ',I)
  327.                           Else Write('NO ASSOCIATED FILES FOUND...');
  328.                         Normvideo;
  329.                         HideCursor;
  330.                         SearchKey(CIndex,RecNum,FKey);
  331.                       End;
  332.                       GotoXY(60,1);Write('Browse / Edit');
  333.                     End Else Boop;
  334.             End;
  335.           Until Done;
  336.           ChildFlag:=False;
  337.         End;
  338.       End; { procedure FileSearch }
  339.  
  340.     PROCEDURE KeywordSearch;
  341.       Begin
  342.         MatchCount:=0;
  343.         J:=0;
  344.         ClearKey(CIndex);
  345.         NextKey(CIndex,RecNum,FKey);
  346.         While OK do begin
  347.           GetRec(CFile,RecNum,FTemp);
  348.           LowVideo;
  349.           GotoXY(1,1);
  350.           Write('SEARCHING: Reading ',FTemp.FileName);
  351.           Matched:=False;
  352.           If FullMatch = True then begin
  353.             S1:=FTemp.Keys;
  354.             Repeat
  355.               Parse(S1,S2);
  356.               If SKey=S2 then Matched:=True;
  357.             Until (Matched=True) or (Length(S1)=0)
  358.           End Else If Pos(SKey,FTemp.Keys)>0 then Matched:=True;
  359.           Done:=False;
  360.           If Matched then MatchCount:=MatchCount+1;
  361.           If Matched and KeyCat then begin
  362.             Boop;
  363.             Normvideo;
  364.             ShowData(RecNum);
  365.             GotoXY(1,23);
  366.             Write('Found ');
  367.             If FullMatch then Write('exact ') else Write('partial ');
  368.             Write('match with Keyword "',SKey,'"');
  369.             If J=0 then begin
  370.               Write(Lst,TDate,' Catalog of files with ');
  371.               If FullMatch then Write(Lst,'exact ') else Write(Lst,'partial ');
  372.               WriteLn(Lst,'match with Keyword "',SKey,'"');
  373.               WriteLn(Lst,ConstStr('-',79));
  374.               WriteLn(Lst);
  375.               J:=3;
  376.             End;
  377.             With FileRec do begin
  378.               S:=FileName;
  379.               Repeat
  380.                 For I:=1 to Length(S) do If S[I]=' ' then Delete(S,I,1);
  381.               Until I=Length(S);
  382.               Write(Lst,S,ConstStr(' ',14-Length(S)));
  383.               Size := (FileSize[1] * 1.0) +
  384.                       (FileSize[2] * 256.0) +
  385.                       (FileSize[3] * 65536.0);
  386.               Year := (FileDate shr 9) + 80;
  387.               Month := (FileDate shl 7) shr 12;
  388.               Day := (FileDate shl 11) shr 11;
  389.               Hour := FileTime shr 11;
  390.               If Hour >= 12 then begin
  391.                 AP := 'p';
  392.                 Hour := Hour - 12;
  393.               End Else AP := 'a';
  394.               If Hour = 0 then Hour := 12;
  395.               Minute := (FileTime shl 5) shr 10;
  396.               Write(Lst,Size:1:0,' Bytes  ');
  397.               Write(Lst,Hour:2,':');
  398.               If Minute < 10 then Write(Lst,'0');
  399.               Write(Lst,Minute,ap,'  ');
  400.               Write(Lst,Month:2,'-');
  401.               If Day < 10 then Write(Lst,'0');
  402.               Write(Lst,Day,'-',Year,'   ');
  403.               WriteLn(Lst,'(',VolPath,')');
  404.               J:=J+1;
  405.               S:=Description[1]+' '+Description[2]+' '+Description[3]+' ';
  406.               I:=3;
  407.               If Length(S)<160 then begin
  408.                 S:=S+Description[4];
  409.                 I:=4;
  410.               End;
  411.               While S<>'' do begin
  412.                 S1:=Copy(S,1,64);
  413.                 K:=Length(S1);
  414.                 If K=64 then While (S1[K]<>' ') and (K<>0) do K:=K-1;
  415.                 S1:=Copy(S1,1,K);
  416.                 Delete(S,1,K);
  417.                 If Length(S1)>0 then begin
  418.                   WriteLn(Lst,ConstStr(' ',14),S1);
  419.                   J:=J+1;
  420.                 End;
  421.                 If (Length(S)<160) and (I<>4) then begin
  422.                   S:=S+Description[4];
  423.                   I:=4;
  424.                 End;
  425.               End;
  426.               If J>=53 then begin
  427.                 Write(Lst,#12);
  428.                 J:=0;
  429.               End;
  430.             End;
  431.           End Else If Matched then Repeat
  432.             Beep;
  433.             Normvideo;
  434.             If NOT Printed then ShowData(RecNum);
  435.             Printed:=False;
  436.             GotoXY(1,23);
  437.             Write('Found ');
  438.             If FullMatch then Write('exact ') else Write('partial ');
  439.             Write('match with Keyword "',SKey,'"');
  440.             GotoXY(1,25);
  441.             Write('        <E> Edit  <*> Print Record  <C> or <N> Continue Search');
  442.             GotoXY(1,24);
  443.             Write('Press:  <Q> Quit  <D> Delete  ');
  444.             ClrEol;
  445.             Repeat
  446.               Read(Kbd,Ch);
  447.               Ch:=Upcase(Ch);
  448.               If NOT (Ch in ['Q','D','E','*','C','N']) then Boop;
  449.             Until Ch in ['Q','D','E','*','C','N'];
  450.             Case Ch of
  451.               'Q' : Exit;
  452.               'D' : Begin
  453.                       Beep;
  454.                       TextColor(7+Blink);
  455.                       Write('Are you sure? Y/N ');
  456.                       NormVideo;
  457.                       RestoreCursor;
  458.                       If YES then DeleteRec(CFile,RecNum);
  459.                       HideCursor;
  460.                     End;
  461.               'E' : Begin
  462.                       Textcolor(7+blink);
  463.                       GotoXY(1,1); ClrEol;
  464.                       Write('EDITING');
  465.                       Normvideo;
  466.                       RestoreCursor;
  467.                       EnterData;
  468.                       FileRec:=FTemp;
  469.                       PutRec(CFile,RecNum,FileRec);
  470.                       HideCursor;
  471.                       GotoXY(1,1);ClrEol;
  472.                       GotoXY(60,1);Write('Keyword Search');
  473.                     End;
  474.               '*' : Begin
  475.                       GotoXY(1,1); Write(ConstStr(' ',40));
  476.                       PrintRec;
  477.                       Printed:=True;
  478.                       GotoXY(1,1);ClrEol;
  479.                       GotoXY(60,1);Write('Keyword Search');
  480.                     End;
  481.               'C' : Done:=True;
  482.               'N' : Done:=True;
  483.             End;
  484.           Until Done;
  485.           NextKey(CIndex,RecNum,FKey);
  486.         End;
  487.         GotoXY(1,1); Write(ConstStr(' ',40));
  488.         GotoXY(1,23);ClrEol;
  489.         GotoXY(1,24);ClrEol;
  490.         GotoXY(1,25);ClrEol;
  491.         Boop;
  492.         LowVideo;
  493.         GotoXY(1,23);Write(MatchCount);
  494.         If NOT FullMatch then Write(' partial');
  495.         Write(' match(es) found for Keyword "',SKey,'"');
  496.         NormVideo;
  497.         GotoXY(1,24);Write('END OF FILE... Press any key to return to menu');
  498.         Read(Kbd,ch);
  499.         If KeyCat and (J>0) then begin
  500.           J:=0;
  501.           Write(Lst,#12);
  502.         End;
  503.       End; { procedure KeywordSearch }
  504.  
  505.   Begin
  506.     ShowScreen;
  507.     EnterSearch;
  508.     Printed:=False;
  509.     GotoXY(60,1);
  510.     If KeySearch then Write('Keyword Search') Else Write('Browse / Edit');
  511.     S2:=FKey;
  512.     OpenFiles;
  513.     ChildFlag:=False;
  514.     If KeySearch then KeywordSearch else FileSearch;
  515.     CloseFiles;
  516.     RestoreCursor;
  517.   End; { procedure BrowseEdit }
  518.  
  519. OVERLAY PROCEDURE PrintAll;
  520.   VAR RecNum:Integer;
  521.       Done:Boolean;
  522.   Begin
  523.     ShowScreen;
  524.     HideCursor;
  525.     GotoXY(1,24); ClrEol; Beep;
  526.     Write('Position printer at beginning of new page.  Press any key when ready.');
  527.     Read(Kbd,Ch);
  528.     GotoXY(1,24); ClrEol;
  529.     If NOT PRTest then repeat
  530.       Beep;
  531.       GotoXY(1,24); ClrEol;
  532.       Write('PRINTER NOT READY. Please correct and press any key when ready or ESC to Quit.');
  533.       Read(Kbd,Ch);
  534.       GotoXY(1,24); ClrEol;
  535.       If (Ch=#27) and (NOT Keypressed) then Exit;
  536.     until PRTest;
  537.     HideCursor;
  538.     GotoXY(60,1);Write('Printing All Files');
  539.     FKey:='';
  540.     Done:=False;
  541.     PrintCount:=0;
  542.     OpenFiles;
  543.     ClearKey(CIndex);
  544.     SearchKey(CIndex,RecNum,FKey);
  545.     If Ok then Repeat
  546.       LowVideo;
  547.       GotoXY(1,24);
  548.       Write('Press <ESC> to Abort Printing...');
  549.       NormVideo;
  550.       ShowData(RecNum);
  551.       PrintRec;
  552.       NextKey(CIndex,RecNum,FKey);
  553.       If KeyPressed then begin
  554.         Read(Kbd,Ch);
  555.         If (Ch=#27) and (NOT Keypressed) then begin
  556.           GotoXY(1,24); ClrEol;
  557.           Write('Escape key detected.  Abort Printing?  Y/N');
  558.           If Yes then Done:=True;
  559.           GotoXY(1,24); ClrEol;
  560.         End;
  561.       End;
  562.     Until (NOT OK) or Done;
  563.     CloseFiles;
  564.     RestoreCursor;
  565.   End; { procedure PrintAll }
  566.  
  567. OVERLAY PROCEDURE DiskCatalog;
  568.   LABEL 1;
  569.   VAR S,S1,S2,SKey,FKey:AnyStr;
  570.       RecNum:Integer;
  571.       Done,PrintIt,FullMatch,Matched,FileCompare:Boolean;
  572.       I,J,K,MatchCount,DeleteCount:Integer;
  573.  
  574.   PROCEDURE EnterSearch;
  575.     Begin
  576.       SaveScreen;
  577.       DrawBox(10,70,17,21);
  578.       BigWindow(11,18,69,20);
  579.       If MonitorType = 7 then begin
  580.         HideCursor;
  581.         For I:=1 to 3 do begin
  582.           GotoXY(1,I);
  583.           Write(ConstStr(' ',59));
  584.         End;
  585.         RestoreCursor;
  586.       End Else ClrScr;
  587.       LowVideo;
  588.       FileCompare:=False;
  589.       PrintIt:=False;
  590.       GotoXY(2,2);
  591.       HideCursor;
  592.       Write(' Compare source files to database for deleted files?  Y/N');
  593.       Beep;
  594.       If YES then begin
  595.         RestoreCursor;
  596.         FileCompare:=True;
  597.         INT24On;
  598.         {$I-}
  599.         ChDir(SourceDirectory);
  600.         {$I+}
  601.         I:=INT24Result;
  602.         INT24Off;
  603.         If I<>0 then begin
  604.           GotoXY(2,2);ClrEol;
  605.           Write(' Drive not ready... press any key to continue.');
  606.           Beep;
  607.           Read(Kbd,Ch);
  608.           I:=9999;
  609.         End;
  610.         NormVideo;
  611.         BigWindow(1,1,80,25);
  612.         RestoreScreen;
  613.         If SourceDirectory[1] in ['A','B'] then SKey:=OldVolumeName
  614.           Else SKey:=SourceDirectory;
  615.         Exit;
  616.       End;
  617.       RestoreCursor;
  618.       PrintIt:=True;
  619.       GotoXY(2,2);ClrEol;
  620.       Write(' Disk/Dir to Search For:');
  621.       Beep;
  622.       NormVideo;
  623.       S1:=OldVolumeName;
  624.       FirstCharDelete:=True;
  625.       InputStr(S1,24,30,2,Af,[#13],Ch);
  626.       If S1='' then I:=9999;
  627.       FirstCharDelete:=False;
  628.       HideCursor;
  629.       BigWindow(1,1,80,25);
  630.       RestoreScreen;
  631.       FKey:=S1;
  632.       SKey:=S1;
  633.       HideCursor;
  634.     End; { procedure EnterSearch }
  635.  
  636.     PROCEDURE KeywordSearch;
  637.       Begin
  638.         MatchCount:=0;
  639.         DeleteCount:=0;
  640.         J:=0;
  641.         ClearKey(CIndex);
  642.         NextKey(CIndex,RecNum,FKey);
  643.         While OK do begin
  644.           GetRec(CFile,RecNum,FTemp);
  645.           LowVideo;
  646.           GotoXY(1,1);
  647.           Write('SEARCHING: Reading ',FTemp.FileName);
  648.           Matched:=False;
  649.           If SKey=FTemp.VolPath then Matched:=True;
  650.           If Matched then MatchCount:=MatchCount+1;
  651.           If Matched and FileCompare then begin
  652.             Normvideo;
  653.             ShowData(RecNum);
  654.             S1:=Copy(FTemp.FileName,1,Pos('.',FTemp.FileName)-1);
  655.             S1:=S1+ConstStr(' ',8-Length(S1));
  656.             S2:=Copy(FTemp.FileName,Pos('.',FTemp.FileName)+1,3);
  657.             S2:=S2+ConstStr(' ',3-Length(S2));
  658.             Done:=False;
  659.             For I := 1 to EntryNum do begin
  660.               If (S1=Entry[I].EName) and (S2=Entry[I].EExt) then Done:=True;
  661.             End;
  662.             If NOT Done then begin
  663.               If J=0 then begin
  664.                 WriteLn(Lst,TDate,' -- Listing of files in Filecat database NOT on ',SKey);
  665.                 WriteLn(Lst,ConstStr('-',79));
  666.                 WriteLn(Lst);
  667.                 J:=3;
  668.               End;
  669.               With FileRec do begin
  670.                 S:=FileName;
  671.                 Repeat
  672.                   For I:=1 to Length(S) do If S[I]=' ' then Delete(S,I,1);
  673.                 Until I=Length(S);
  674.                 Write(Lst,'[ ] CHECK --> ',S,ConstStr(' ',14-Length(S)));
  675.                 Size := (FileSize[1] * 1.0) +
  676.                         (FileSize[2] * 256.0) +
  677.                         (FileSize[3] * 65536.0);
  678.                 Year := (FileDate shr 9) + 80;
  679.                 Month := (FileDate shl 7) shr 12;
  680.                 Day := (FileDate shl 11) shr 11;
  681.                 Hour := FileTime shr 11;
  682.                 If Hour >= 12 then begin
  683.                   AP := 'p';
  684.                   Hour := Hour - 12;
  685.                 End Else AP := 'a';
  686.                 If Hour = 0 then Hour := 12;
  687.                 Minute := (FileTime shl 5) shr 10;
  688.                 Write(Lst,Size:1:0,' Bytes  ');
  689.                 Write(Lst,Hour:2,':');
  690.                 If Minute < 10 then Write(Lst,'0');
  691.                 Write(Lst,Minute,ap,'  ');
  692.                 Write(Lst,Month:2,'-');
  693.                 If Day < 10 then Write(Lst,'0');
  694.                 Write(Lst,Day,'-',Year,'   ');
  695.                 WriteLn(Lst,'(Record #',RecNum,')');
  696.                 J:=J+1;
  697.                 If J>=53 then begin
  698.                   Write(Lst,#12);
  699.                   J:=0;
  700.                 End;
  701.               End;
  702.             End;
  703.           End Else If Matched then begin
  704.             Boop;
  705.             Normvideo;
  706.             ShowData(RecNum);
  707.             GotoXY(1,23);
  708.             Write('Found match with Disk/Dir "',SKey,'"');
  709.             If J=0 then begin
  710.               WriteLn(Lst,TDate,' Catalog of files on ',SKey);
  711.               WriteLn(Lst,ConstStr('-',79));
  712.               WriteLn(Lst);
  713.               J:=3;
  714.             End;
  715.             With FileRec do begin
  716.               S:=FileName;
  717.               Repeat
  718.                 For I:=1 to Length(S) do If S[I]=' ' then Delete(S,I,1);
  719.               Until I=Length(S);
  720.               Write(Lst,S,ConstStr(' ',14-Length(S)));
  721.               Size := (FileSize[1] * 1.0) +
  722.                       (FileSize[2] * 256.0) +
  723.                       (FileSize[3] * 65536.0);
  724.               Year := (FileDate shr 9) + 80;
  725.               Month := (FileDate shl 7) shr 12;
  726.               Day := (FileDate shl 11) shr 11;
  727.               Hour := FileTime shr 11;
  728.               If Hour >= 12 then begin
  729.                 AP := 'p';
  730.                 Hour := Hour - 12;
  731.               End Else AP := 'a';
  732.               If Hour = 0 then Hour := 12;
  733.               Minute := (FileTime shl 5) shr 10;
  734.               Write(Lst,Size:1:0,' Bytes  ');
  735.               Write(Lst,Hour:2,':');
  736.               If Minute < 10 then Write(Lst,'0');
  737.               Write(Lst,Minute,ap,'  ');
  738.               Write(Lst,Month:2,'-');
  739.               If Day < 10 then Write(Lst,'0');
  740.               Write(Lst,Day,'-',Year,'   ');
  741.               WriteLn(Lst,'(',VolPath,')');
  742.               J:=J+1;
  743.               S:=Description[1]+' '+Description[2]+' '+Description[3]+' ';
  744.               I:=3;
  745.               If Length(S)<160 then begin
  746.                 S:=S+Description[4];
  747.                 I:=4;
  748.               End;
  749.               While S<>'' do begin
  750.                 S1:=Copy(S,1,64);
  751.                 K:=Length(S1);
  752.                 If K=64 then While (S1[K]<>' ') and (K<>0) do K:=K-1;
  753.                 S1:=Copy(S1,1,K);
  754.                 Delete(S,1,K);
  755.                 If (Length(S1)>0) and (S1<>'   ') then begin
  756.                   WriteLn(Lst,ConstStr(' ',14),S1);
  757.                   J:=J+1;
  758.                 End;
  759.                 If (Length(S)<160) and (I<>4) then begin
  760.                   S:=S+Description[4];
  761.                   I:=4;
  762.                 End;
  763.               End;
  764.               If J>=53 then begin
  765.                 Write(Lst,#12);
  766.                 J:=0;
  767.               End;
  768.             End;
  769.           End;
  770.           NextKey(CIndex,RecNum,FKey);
  771.         End;
  772.         GotoXY(1,1); Write(ConstStr(' ',40));
  773.         GotoXY(1,23);ClrEol;
  774.         GotoXY(1,24);ClrEol;
  775.         GotoXY(1,25);ClrEol;
  776.         Boop;
  777.         LowVideo;
  778.         GotoXY(1,23);Write(MatchCount);
  779.         Write(' match(es) found for Disk/Directory "',SKey,'"');
  780.         NormVideo;
  781.         GotoXY(1,24);Write('END OF FILE... Press any key to return to menu');
  782.         Read(Kbd,ch);
  783.         If J>0 then begin
  784.           J:=0;
  785.           Write(Lst,#12);
  786.         End;
  787.       End; { procedure KeywordSearch }
  788.  
  789.   Begin
  790.     ShowScreen;
  791.     If NOT PRTest then repeat
  792.       Beep;
  793.       GotoXY(1,24); ClrEol;
  794.       Write('PRINTER NOT READY. Please correct and press any key when ready or ESC to Quit.');
  795.       Read(Kbd,Ch);
  796.       GotoXY(1,24); ClrEol;
  797.       If (Ch=#27) and (NOT Keypressed) then Exit;
  798.     until PRTest;
  799.     OpenFiles;
  800.     EnterSearch;
  801.     If I=9999 then goto 1;
  802.     If FileCompare=True then begin
  803.       BuildArray;
  804.       If EntryNum=0 then goto 1;
  805.     End;
  806.     GotoXY(60,1);
  807.     Write('Disk Catalog');
  808.     KeywordSearch;
  809. 1:
  810.     CloseFiles;
  811.     RestoreCursor;
  812.     ChDir(EntryDirectory);
  813.   End; { procedure DiskCatalog }